﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.loading.loaders {
    import flash.display.*;
    import flash.errors.*;
    import flash.events.*;
    import flash.net.*;
    import flash.system.*;

    public class SWFLoader extends AbstractLoader {

        private var _loader:Loader;

        public function SWFLoader(){
            this._loader = new Loader();
            super();
        }
        override public function start():void{
            super.start();
            var context:LoaderContext = new LoaderContext(true, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
            try {
				
//				if(path="http://cdn4.wooga.com/assets/background.11435C.swf"){
//					this._loader.load(new URLRequest("./background.11435C.swf"), context);
//				}
//				
//				else
                	this._loader.load(this.getRequest(path), context);
            } catch(error:IOError) {
                l(("could not load " + path));
            };
        }
        override protected function get data(){
            return (this._loader.content);
        }
        override protected function get dispatcher():IEventDispatcher{
            return (this._loader.contentLoaderInfo);
        }
        override public function get currentSize():int{
            return (this._loader.contentLoaderInfo.bytesLoaded);
        }
        override public function get totalSize():int{
            return (((this._loader.contentLoaderInfo.bytesTotal) || (super.totalSize)));
        }
        override protected function onError(_arg1:IOErrorEvent):void{
            if (_retries < MAX_RETRIES){
                _retries++;
                this.start();
            } else {
                super.onError(_arg1);
            };
        }
        override protected function getRequest(_arg1:String):URLRequest{
            if (_retries){
                params = ((params) || (new URLVariables()));
                params.retry = ((_retries.toString() + "_") + Math.random());
            };
            return (super.getRequest(_arg1));
        }

    }
}//package net.wooga.pets.loading.loaders 
